package com.webcamtracker.image.color.rgb;

public class NormRGBColor extends RGBColor {
    private int coeficient;

    public NormRGBColor() {
        super();
    }


    public NormRGBColor(int read, int green, int blue) {
        super(read, green, blue);
        coeficient = read + green + blue;
    }

    public NormRGBColor(int rgbColor) {
        super(rgbColor);
        coeficient = (rgbColor & 0x00FF0000) >> 16 + (rgbColor & 0x0000FF00) >> 8 + (rgbColor & 0x000000FF);
        if (coeficient == 0) {
            coeficient = 1;
        }
    }


    public int getRed() {
        return super.getRed() / coeficient;
    }

    public int getGreen() {
        return super.getGreen() / coeficient;
    }

    public int getBlue() {
        return super.getBlue() / coeficient;
    }

    public int getCoeficient() {
        return coeficient;
    }

    public double[] elements() {
        return new double[]{getRed(), getGreen(), getBlue()};
    }
}






